/*
 * GlideManager.java
 * business
 *
 * Created by ChenTao on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.manager;

import android.content.Context;

import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.integration.okhttp3.OkHttpGlideModule;
import com.bumptech.glide.load.DecodeFormat;

/** Glide的全局配置. */
public class GlideManager extends OkHttpGlideModule {

    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        // 修改到SD卡有时会有bug...
        //
        //        // 修改Glide的缓存地址到sd卡
        //        File file = CacheUtils.getAppCacheDir(context, Common.IMAGE_DIR_NAME);
        //        String cachePath = file.getAbsolutePath();
        //
        //        // 设置缓存大小为 100M
        //        int cacheSize100MegaBytes = 100 * 1024 * 1024;
        //        builder.setDiskCache(new DiskLruCacheFactory(cachePath, cacheSize100MegaBytes));

        builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
    }
}
